home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / ams__l~1.zoo / src / doublebu.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-05  |  923 b   |  44 lines

  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. //  This file is part of the Atari Machine Specific Library,
  4. //  and is Copyright 1992 by Warwick W. Allison.
  5. //
  6. //  You are free to copy and modify these sources, provided you acknowledge
  7. //  the origin by retaining this notice, and adhere to the conditions
  8. //  described in the file COPYING.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11.  
  12. #include "DoubleBuffer.h"
  13. #include <osbind.h>
  14.  
  15. static Screen Desk(DESKSCREEN);
  16. DoubleBuffer *Pages=new DoubleBuffer(Desk,Desk);
  17.  
  18. DoubleBuffer::DoubleBuffer()
  19. {
  20.     Canvas[0]=new Screen;
  21.     Canvas[1]=new Screen;
  22.     Pulse=0;
  23. }
  24.  
  25. DoubleBuffer::DoubleBuffer(Screen& a, Screen& b)
  26. {
  27.     Canvas[0]=&a;
  28.     Canvas[1]=&b;
  29.     Pulse=0;
  30. }
  31.  
  32. void DoubleBuffer::Flip()
  33. {
  34.     Canvas[Pulse]->Show();
  35.     Vsync();
  36.     Pulse=1-Pulse;
  37. }
  38.  
  39. void DoubleBuffer::Flop()
  40. {
  41.     Canvas[Pulse]->Show();
  42.     Pulse=1-Pulse;
  43. }
  44.